import mainFrame from '@/components/main-frame'
import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInBread: (false) 设为true后此级路由将不会出现在面包屑中，示例看QQ群路由配置
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面在切换标签后不会缓存，如果需要缓存，无需设置这个字段，而且需要设置页面组件name属性和路由配置的name一致
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 * }
 */

export default [
    {
        path: '/login',
        name: 'login',
        meta: {
            title: 'Login - 登录',
            hideInMenu: true
        },
        component: () => import('@/views/login/login.vue')
    },
    {
        path: '/',
        name: '_home',
        redirect: '/home',
        component: mainFrame,
        meta: {
            hideInMenu: true,
            notCache: true
        },
        children: [
            {
                path: '/home',
                name: 'home',
                meta: {
                    hideInMenu: true,
                    title: '首页',
                    notCache: true,
                    icon: 'md-home'
                },
                component: () => import('@/views/home/home.vue')
            }
        ]
    },
    {
        path: '/ad',
        name: 'ad',
        component: mainFrame,
        meta: {
            hideInBread: true
        },
        children: [
            {
                path: 'index',
                name: 'ad_page',
                meta: {
                    icon: 'md-images',
                    title: '广告管理'
                },
                component: () => import('@/views/ad')
            }
        ]
    },
    {
        path: '/graphic',
        name: 'graphic',
        meta: {
            icon: 'md-photos',
            title: '图文管理'
        },
        component: mainFrame,
        children: [
            {
                path: 'category',
                name: 'category',
                meta: {
                    access: ['super_admin'],
                    icon: 'ios-albums',
                    showAlways: true,
                    title: '分类管理'
                },
                component: parentView,
                children: [
                    {
                        path: 'index',
                        name: 'category_index',
                        meta: {
                            icon: '',
                            title: '分类列表'
                        },
                        component: () => import('@/views/graphic/category/')
                    },
                    {
                        path: 'add',
                        name: 'category_add',
                        meta: {
                            icon: '',
                            title: '添加分类'
                        },
                        component: () => import('@/views/graphic/category/add.vue')
                    },
                ]
            },
            {
                path: 'tag',
                name: 'tag',
                meta: {
                    access: ['super_admin'],
                    icon: 'ios-pricetags',
                    showAlways: true,
                    title: '标签管理'
                },
                component: parentView,
                children: [
                    {
                        path: 'index',
                        name: 'tag_index',
                        meta: {
                            icon: '',
                            title: '标签列表'
                        },
                        component: () => import('@/views/graphic/tag/')
                    },
                    {
                        path: 'add',
                        name: 'tag_add',
                        meta: {
                            icon: '',
                            title: '添加标签'
                        },
                        component: () => import('@/views/graphic/tag/add.vue')
                    },
                ]
            }
        ]
    },
    {
        path: '/member',
        name: 'member',
        meta: {
            icon: 'md-person',
            title: '会员管理'
        },
        component: mainFrame,
        children: [
            {
                path: 'index',
                name: 'member_index',
                meta: {
                    icon: 'ios-document',
                    title: '会员列表'
                },
                component: () => import('@/views/member/')
            },
            {
                path: 'add',
                name: 'member_add',
                meta: {
                    icon: 'md-clipboard',
                    title: '添加会员',
                    showAlways: false
                },
                component: () => import('@/views/member/add.vue')
            }
        ]
    },
    {
        path: '/admin',
        name: 'admin',
        meta: {
            icon: 'md-person-add',
            title: '管理员管理'
        },
        component: mainFrame,
        children: [
            {
                path: 'index',
                name: 'admin_index',
                meta: {
                    icon: 'ios-document',
                    title: '权限列表'
                },
                component: () => import('@/views/admin/')
            },
            {
                path: 'add',
                name: 'admin_add',
                meta: {
                    icon: 'md-clipboard',
                    title: '添加权限',
                    showAlways: false
                },
                component: () => import('@/views/admin/add.vue')
            }
        ]
    },
    {
        path: '/authority',
        name: 'authority',
        meta: {
            icon: 'md-key',
            title: '权限管理'
        },
        component: mainFrame,
        children: [
            {
                path: 'index',
                name: 'authority_index',
                meta: {
                    icon: 'ios-document',
                    title: '权限列表'
                },
                component: () => import('@/views/authority/')
            },
            {
                path: 'add',
                name: 'authority_add',
                meta: {
                    icon: 'md-clipboard',
                    title: '添加权限',
                    showAlways: false
                },
                component: () => import('@/views/authority/add.vue')
            }
        ]
    },
    {
        path: '/log',
        name: 'log',
        component: mainFrame,
        meta: {
            hideInBread: true
        },
        children: [
            {
                path: 'index',
                name: 'log_page',
                meta: {
                    icon: 'md-paw',
                    title: '操作日志'
                },
                component: () => import('@/views/log')
            }
        ]
    },
    {
        path: '/system',
        name: 'system',
        component: mainFrame,
        meta: {
            hideInBread: true
        },
        children: [
            {
                path: 'index',
                name: 'system_page',
                meta: {
                    icon: 'ios-people',
                    title: '系统管理'
                },
                component: () => import('@/views/system/')
            }
        ]
    }
]
